import { Component, _decorator, tween, v3 } from 'cc';
const { ccclass, property ,menu} = _decorator;

@ccclass('ComScaleAction')
@menu("扩展组件/ComScaleAction")
export class ComScaleAction extends Component {
    @property duration: number = 1.0;
    private tween: any;
    start() {

    }

    update(deltaTime: number) {

    }

    onEnable() {
        this.tween = tween(this.node).repeatForever(tween(this.node)
            .to(0.5 / this.duration, { scale: v3(1.08,1.08,1) })
            .to(0.5 / this.duration, { scale: v3(0.98,0.98,1) })
        ).start();;
    }

    onDisable() {
        if (this.tween) {
            this.tween.stop();
            this.tween = null;
        }
    }
}

